import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProcessVO, ProcessForm, ProcessQuery } from '@/api/basedata/process/types';

/**
 * 查询制造工艺维护列表
 * @param query
 * @returns {*}
 */

export const listProcess = (query?: ProcessQuery): AxiosPromise<ProcessVO[]> => {
  return request({
    url: '/basedata/process/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询制造工艺维护详细
 * @param id
 */
export const getProcess = (id: string | number): AxiosPromise<ProcessVO> => {
  return request({
    url: '/basedata/process/' + id,
    method: 'get'
  });
};

/**
 * 新增制造工艺维护
 * @param data
 */
export const addProcess = (data: ProcessForm) => {
  return request({
    url: '/basedata/process',
    method: 'post',
    data: data
  });
};

/**
 * 修改制造工艺维护
 * @param data
 */
export const updateProcess = (data: ProcessForm) => {
  return request({
    url: '/basedata/process',
    method: 'put',
    data: data
  });
};

/**
 * 删除制造工艺维护
 * @param id
 */
export const delProcess = (id: string | number | Array<string | number>) => {
  return request({
    url: '/basedata/process/' + id,
    method: 'delete'
  });
};
